import request from '@/utils/request'

// 获取销售员列表
export function getSalespeopleList(params) {
  return request({
    url: '/api/salespeople',
    method: 'get',
    params
  })
}

// 获取销售员详情
export function getSalespersonDetail(id) {
  return request({
    url: `/api/salespeople/${id}`,
    method: 'get'
  })
}

// 创建销售员
export function createSalesperson(data) {
  return request({
    url: '/api/salespeople',
    method: 'post',
    data
  })
}

// 更新销售员信息
export function updateSalesperson(id, data) {
  return request({
    url: `/api/salespeople/${id}`,
    method: 'put',
    data
  })
}

// 设置销售目标
export function setSalesTarget(id, data) {
  return request({
    url: `/api/salespeople/${id}/target`,
    method: 'post',
    data
  })
}

// 更新销售员状态
export function updateSalespersonStatus(id, status) {
  return request({
    url: `/api/salespeople/${id}/status`,
    method: 'put',
    data: { status }
  })
}

// 获取销售员的客户列表
export function getSalespersonCustomers(id, params) {
  return request({
    url: `/api/salespeople/${id}/customers`,
    method: 'get',
    params
  })
}

// 导出销售员数据
export function exportSalespeopleData(params) {
  return request({
    url: '/api/salespeople/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 获取销售员业绩统计
export function getSalespersonStats(id, params) {
  return request({
    url: `/api/salespeople/${id}/stats`,
    method: 'get',
    params
  })
} 